<ion-modal-view>
    <ion-header-bar align-title="center" class="bar-energized-crm">
        <button class="button button-clear" ng-click="closeGalleryModal()">关闭</button>
        <h1 class="title">{{galleryTitle || "图片列表"}}</h1>
        <button class="button button-clear" ng-if="!gallerySelectFlag" ng-click="selectGallery()">选择</button>
        <button class="button button-clear" ng-if="gallerySelectFlag" ng-click="deleteGallery()">删除</button>
    </ion-header-bar>
    <ion-content class="padding">
        <!--<ion-gallery ion-gallery-items="galleryItems" ion-item-callback="galleryCallback(item)"></ion-gallery>-->
        <div class="row crm-gallery-row" style="margin-bottom: 5px;" ng-repeat="item in galleryItems track by $index" ng-if="$index % 3 === 0">
            <div class="col col-33 position-relative">
                <div class="plus text-center" ng-click="chooseUploadType()" ng-if="$index + 1 === galleryItems.length && galleryItems.length <= photoNum">
                    <div class="plus-vertical"></div>
                    <div class="plus-lateral"></div>
                </div>
                <img ng-src="{{item.src}}" on-hold="selectGallery()" ng-click="openBrowserModal(galleryItems, $index)" ng-if="$index + 1 < galleryItems.length">
                <i class="icon ion-ios-checkmark-outline delete-image" ng-class="{true: 'delete-image-select'}[item.active]" ng-if="gallerySelectFlag"></i>
            </div>
            <div class="col col-33 position-relative" ng-if="($index + 1) % 3 === 1 && $index + 1 <= galleryItems.length">
                <div class="plus text-center" ng-click="chooseUploadType()" ng-if="$index + 2 === galleryItems.length && galleryItems.length <= photoNum">
                    <div class="plus-vertical"></div>
                    <div class="plus-lateral"></div>
                </div>
                <img ng-src="{{galleryItems[$index + 1].src}}" on-hold="selectGallery()" ng-click="openBrowserModal(galleryItems, $index + 1)" ng-if="$index + 2 < galleryItems.length">
                <i class="icon ion-ios-checkmark-outline delete-image" ng-class="{true: 'delete-image-select'}[galleryItems[$index + 1].active]" ng-if="gallerySelectFlag"></i>
            </div>
            <div class="col col-33 position-relative" ng-if="($index + 2) % 3 === 2 && $index + 1 <= galleryItems.length">
                <div class="plus text-center" ng-click="chooseUploadType()" ng-if="$index + 3 === galleryItems.length && galleryItems.length <= photoNum">
                    <div class="plus-vertical"></div>
                    <div class="plus-lateral"></div>
                </div>
                <img ng-src="{{galleryItems[$index + 2].src}}" on-hold="selectGallery()" ng-click="openBrowserModal(galleryItems, $index + 2)" ng-if="$index + 3 < galleryItems.length">
                <i class="icon ion-ios-checkmark-outline delete-image" ng-class="{true: 'delete-image-select'}[galleryItems[$index + 2].active]" ng-if="gallerySelectFlag"></i>
            </div>
        </div>
    </ion-content>
</ion-modal-view>